import 'package:appflutterhomeschool/res/styles.dart';
import 'package:appflutterhomeschool/utils/utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

///用户：Nine Tailed Fox
///时间：2020/6/8
///邮箱：1037438704@qq.com
///功能：我的页面条状的页面跳转

class GeneralPageJumpWidget extends StatelessWidget {
  final String image;
  final String title;
  final String rightContent;
  final GestureTapCallback onTap;
  final TextStyle textTitleStyle,textRightStyle;
  final EdgeInsetsGeometry margin;


  GeneralPageJumpWidget(
      {this.image,
      this.title,
      this.rightContent,
      this.margin,
      this.textRightStyle,
      this.onTap,
      this.textTitleStyle});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        margin: margin??null,
        padding: EdgeInsets.only(
            left: ScreenUtil().setWidth(34), right: ScreenUtil().setWidth(34)),
        color: Colors.white,
        height: ScreenUtil().setWidth(130),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            Visibility(
              visible: image != null,
              child: Image.asset(Utils.getImgPath(image)),
            ),
            Visibility(
              visible: image != null,
              child: SizedBox(width: 10),
            ),
            Expanded(child: Text(title ?? "", style: textTitleStyle??TextStyles.textDark36)),
            Visibility(
              visible: rightContent != null,
              child: Text(rightContent ?? "", style: textRightStyle??TextStyles.textBlue36),
            ),
            Icon(Icons.chevron_right, color: Colors.grey)
          ],
        ),
      ),
      onTap: onTap,
    );
  }
}
